(0) Obligation:

The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

lte(Cons(x', xs'), Cons(x, xs)) → lte(xs', xs)
lte(Cons(x, xs), Nil) → False
even(Cons(x, Nil)) → False
even(Cons(x', Cons(x, xs))) → even(xs)
notEmpty(Cons(x, xs)) → True
notEmpty(Nil) → False
lte(Nil, y) → True
even(Nil) → True
goal(x, y) → and(lte(x, y), even(x))

The (relative) TRS S consists of the following rules:

and(False, False) → False
and(True, False) → False
and(False, True) → False
and(True, True) → True

Rewrite Strategy: INNERMOST

(1) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed relative TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

lte(Cons(x', xs'), Cons(x, xs)) → lte(xs', xs) [1]
lte(Cons(x, xs), Nil) → False [1]
even(Cons(x, Nil)) → False [1]
even(Cons(x', Cons(x, xs))) → even(xs) [1]
notEmpty(Cons(x, xs)) → True [1]
notEmpty(Nil) → False [1]
lte(Nil, y) → True [1]
even(Nil) → True [1]
goal(x, y) → and(lte(x, y), even(x)) [1]
and(False, False) → False [0]
and(True, False) → False [0]
and(False, True) → False [0]
and(True, True) → True [0]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

lte(Cons(x', xs'), Cons(x, xs)) → lte(xs', xs) [1]
lte(Cons(x, xs), Nil) → False [1]
even(Cons(x, Nil)) → False [1]
even(Cons(x', Cons(x, xs))) → even(xs) [1]
notEmpty(Cons(x, xs)) → True [1]
notEmpty(Nil) → False [1]
lte(Nil, y) → True [1]
even(Nil) → True [1]
goal(x, y) → and(lte(x, y), even(x)) [1]
and(False, False) → False [0]
and(True, False) → False [0]
and(False, True) → False [0]
and(True, True) → True [0]

The TRS has the following type information:
lte :: Cons:Nil → Cons:Nil → False:True
Cons :: a → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
False :: False:True
even :: Cons:Nil → False:True
notEmpty :: Cons:Nil → False:True
True :: False:True
goal :: Cons:Nil → Cons:Nil → False:True
and :: False:True → False:True → False:True

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

and(v0, v1) → null_and [0]

And the following fresh constants:

null_and, const

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

lte(Cons(x', xs'), Cons(x, xs)) → lte(xs', xs) [1]
lte(Cons(x, xs), Nil) → False [1]
even(Cons(x, Nil)) → False [1]
even(Cons(x', Cons(x, xs))) → even(xs) [1]
notEmpty(Cons(x, xs)) → True [1]
notEmpty(Nil) → False [1]
lte(Nil, y) → True [1]
even(Nil) → True [1]
goal(x, y) → and(lte(x, y), even(x)) [1]
and(False, False) → False [0]
and(True, False) → False [0]
and(False, True) → False [0]
and(True, True) → True [0]
and(v0, v1) → null_and [0]

The TRS has the following type information:
lte :: Cons:Nil → Cons:Nil → False:True:null_and
Cons :: a → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
False :: False:True:null_and
even :: Cons:Nil → False:True:null_and
notEmpty :: Cons:Nil → False:True:null_and
True :: False:True:null_and
goal :: Cons:Nil → Cons:Nil → False:True:null_and
and :: False:True:null_and → False:True:null_and → False:True:null_and
null_and :: False:True:null_and
const :: a

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

Nil => 0
False => 1
True => 2
null_and => 0
const => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

and(z, z') -{ 0 }→ 2 :|: z = 2, z' = 2
and(z, z') -{ 0 }→ 1 :|: z = 1, z' = 1
and(z, z') -{ 0 }→ 1 :|: z = 2, z' = 1
and(z, z') -{ 0 }→ 1 :|: z' = 2, z = 1
and(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
even(z) -{ 1 }→ even(xs) :|: xs >= 0, x' >= 0, x >= 0, z = 1 + x' + (1 + x + xs)
even(z) -{ 1 }→ 2 :|: z = 0
even(z) -{ 1 }→ 1 :|: x >= 0, z = 1 + x + 0
goal(z, z') -{ 1 }→ and(lte(x, y), even(x)) :|: x >= 0, y >= 0, z = x, z' = y
lte(z, z') -{ 1 }→ lte(xs', xs) :|: xs >= 0, z' = 1 + x + xs, x' >= 0, xs' >= 0, x >= 0, z = 1 + x' + xs'
lte(z, z') -{ 1 }→ 2 :|: y >= 0, z = 0, z' = y
lte(z, z') -{ 1 }→ 1 :|: z = 1 + x + xs, xs >= 0, x >= 0, z' = 0
notEmpty(z) -{ 1 }→ 2 :|: z = 1 + x + xs, xs >= 0, x >= 0
notEmpty(z) -{ 1 }→ 1 :|: z = 0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[lte(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[even(V, Out)],[V >= 0]).
eq(start(V, V1),0,[notEmpty(V, Out)],[V >= 0]).
eq(start(V, V1),0,[goal(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[and(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(lte(V, V1, Out),1,[lte(V2, V3, Ret)],[Out = Ret,V3 >= 0,V1 = 1 + V3 + V4,V5 >= 0,V2 >= 0,V4 >= 0,V = 1 + V2 + V5]).
eq(lte(V, V1, Out),1,[],[Out = 1,V = 1 + V6 + V7,V7 >= 0,V6 >= 0,V1 = 0]).
eq(even(V, Out),1,[],[Out = 1,V8 >= 0,V = 1 + V8]).
eq(even(V, Out),1,[even(V9, Ret1)],[Out = Ret1,V9 >= 0,V10 >= 0,V11 >= 0,V = 2 + V10 + V11 + V9]).
eq(notEmpty(V, Out),1,[],[Out = 2,V = 1 + V12 + V13,V13 >= 0,V12 >= 0]).
eq(notEmpty(V, Out),1,[],[Out = 1,V = 0]).
eq(lte(V, V1, Out),1,[],[Out = 2,V14 >= 0,V = 0,V1 = V14]).
eq(even(V, Out),1,[],[Out = 2,V = 0]).
eq(goal(V, V1, Out),1,[lte(V15, V16, Ret0),even(V15, Ret11),and(Ret0, Ret11, Ret2)],[Out = Ret2,V15 >= 0,V16 >= 0,V = V15,V1 = V16]).
eq(and(V, V1, Out),0,[],[Out = 1,V = 1,V1 = 1]).
eq(and(V, V1, Out),0,[],[Out = 1,V = 2,V1 = 1]).
eq(and(V, V1, Out),0,[],[Out = 1,V1 = 2,V = 1]).
eq(and(V, V1, Out),0,[],[Out = 2,V = 2,V1 = 2]).
eq(and(V, V1, Out),0,[],[Out = 0,V17 >= 0,V18 >= 0,V = V17,V1 = V18]).
input_output_vars(lte(V,V1,Out),[V,V1],[Out]).
input_output_vars(even(V,Out),[V],[Out]).
input_output_vars(notEmpty(V,Out),[V],[Out]).
input_output_vars(goal(V,V1,Out),[V,V1],[Out]).
input_output_vars(and(V,V1,Out),[V,V1],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [and/3]
1. recursive : [even/2]
2. recursive : [lte/3]
3. non_recursive : [goal/3]
4. non_recursive : [notEmpty/2]
5. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into and/3
1. SCC is partially evaluated into even/2
2. SCC is partially evaluated into lte/3
3. SCC is partially evaluated into goal/3
4. SCC is partially evaluated into notEmpty/2
5. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations and/3
* CE 20 is refined into CE [21]
* CE 19 is refined into CE [22]
* CE 17 is refined into CE [23]
* CE 18 is refined into CE [24]
* CE 16 is refined into CE [25]


### Cost equations --> "Loop" of and/3
* CEs [21] --> Loop 16
* CEs [22] --> Loop 17
* CEs [23] --> Loop 18
* CEs [24] --> Loop 19
* CEs [25] --> Loop 20

### Ranking functions of CR and(V,V1,Out)

#### Partial ranking functions of CR and(V,V1,Out)


### Specialization of cost equations even/2
* CE 10 is refined into CE [26]
* CE 12 is refined into CE [27]
* CE 11 is refined into CE [28]


### Cost equations --> "Loop" of even/2
* CEs [28] --> Loop 21
* CEs [26] --> Loop 22
* CEs [27] --> Loop 23

### Ranking functions of CR even(V,Out)
* RF of phase [21]: [V-1]

#### Partial ranking functions of CR even(V,Out)
* Partial RF of phase [21]:
- RF of loop [21:1]:
V-1


### Specialization of cost equations lte/3
* CE 8 is refined into CE [29]
* CE 9 is refined into CE [30]
* CE 7 is refined into CE [31]


### Cost equations --> "Loop" of lte/3
* CEs [31] --> Loop 24
* CEs [29] --> Loop 25
* CEs [30] --> Loop 26

### Ranking functions of CR lte(V,V1,Out)
* RF of phase [24]: [V,V1]

#### Partial ranking functions of CR lte(V,V1,Out)
* Partial RF of phase [24]:
- RF of loop [24:1]:
V
V1


### Specialization of cost equations goal/3
* CE 15 is refined into CE [32,33,34,35,36,37,38,39,40,41,42,43,44,45]


### Cost equations --> "Loop" of goal/3
* CEs [44] --> Loop 27
* CEs [38,40,42] --> Loop 28
* CEs [39,41,43,45] --> Loop 29
* CEs [34,36] --> Loop 30
* CEs [35,37] --> Loop 31
* CEs [32] --> Loop 32
* CEs [33] --> Loop 33

### Ranking functions of CR goal(V,V1,Out)

#### Partial ranking functions of CR goal(V,V1,Out)


### Specialization of cost equations notEmpty/2
* CE 13 is refined into CE [46]
* CE 14 is refined into CE [47]


### Cost equations --> "Loop" of notEmpty/2
* CEs [46] --> Loop 34
* CEs [47] --> Loop 35

### Ranking functions of CR notEmpty(V,Out)

#### Partial ranking functions of CR notEmpty(V,Out)


### Specialization of cost equations start/2
* CE 2 is refined into CE [48,49,50,51]
* CE 3 is refined into CE [52,53,54]
* CE 4 is refined into CE [55,56]
* CE 5 is refined into CE [57,58,59,60,61,62,63]
* CE 6 is refined into CE [64,65,66,67,68]


### Cost equations --> "Loop" of start/2
* CEs [49,59,60] --> Loop 36
* CEs [67] --> Loop 37
* CEs [66] --> Loop 38
* CEs [53,54,56,65] --> Loop 39
* CEs [50,51,61,62,63,64,68] --> Loop 40
* CEs [48,52,55,57,58] --> Loop 41

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of and(V,V1,Out):
* Chain [20]: 0
with precondition: [V=1,V1=1,Out=1]

* Chain [19]: 0
with precondition: [V=1,V1=2,Out=1]

* Chain [18]: 0
with precondition: [V=2,V1=1,Out=1]

* Chain [17]: 0
with precondition: [V=2,V1=2,Out=2]

* Chain [16]: 0
with precondition: [Out=0,V>=0,V1>=0]


#### Cost of chains of even(V,Out):
* Chain [[21],23]: 1*it(21)+1
Such that:it(21) =< V

with precondition: [Out=2,V>=2]

* Chain [[21],22]: 1*it(21)+1
Such that:it(21) =< V

with precondition: [Out=1,V>=3]

* Chain [23]: 1
with precondition: [V=0,Out=2]

* Chain [22]: 1
with precondition: [Out=1,V>=1]


#### Cost of chains of lte(V,V1,Out):
* Chain [[24],26]: 1*it(24)+1
Such that:it(24) =< V1

with precondition: [Out=2,V>=1,V1>=1]

* Chain [[24],25]: 1*it(24)+1
Such that:it(24) =< V1

with precondition: [Out=1,V>=2,V1>=1]

* Chain [26]: 1
with precondition: [V=0,Out=2,V1>=0]

* Chain [25]: 1
with precondition: [V1=0,Out=1,V>=1]


#### Cost of chains of goal(V,V1,Out):
* Chain [33]: 3
with precondition: [V=0,Out=0,V1>=0]

* Chain [32]: 3
with precondition: [V=0,Out=2,V1>=0]

* Chain [31]: 2*s(2)+3
Such that:aux(1) =< V
s(2) =< aux(1)

with precondition: [V1=0,Out=0,V>=1]

* Chain [30]: 2*s(4)+3
Such that:aux(2) =< V
s(4) =< aux(2)

with precondition: [V1=0,Out=1,V>=1]

* Chain [29]: 4*s(6)+4*s(7)+3
Such that:aux(3) =< V
aux(4) =< V1
s(7) =< aux(3)
s(6) =< aux(4)

with precondition: [Out=0,V>=1,V1>=1]

* Chain [28]: 3*s(14)+3*s(15)+3
Such that:aux(5) =< V
aux(6) =< V1
s(15) =< aux(5)
s(14) =< aux(6)

with precondition: [Out=1,V>=1,V1>=1]

* Chain [27]: 1*s(20)+1*s(21)+3
Such that:s(21) =< V
s(20) =< V1

with precondition: [Out=2,V>=2,V1>=1]


#### Cost of chains of notEmpty(V,Out):
* Chain [35]: 1
with precondition: [V=0,Out=1]

* Chain [34]: 1
with precondition: [Out=2,V>=1]


#### Cost of chains of start(V,V1):
* Chain [41]: 3
with precondition: [V=0]

* Chain [40]: 10*s(22)+8*s(26)+3
Such that:aux(7) =< V
aux(8) =< V1
s(26) =< aux(7)
s(22) =< aux(8)

with precondition: [V>=0,V1>=0]

* Chain [39]: 2*s(34)+1
Such that:aux(9) =< V
s(34) =< aux(9)

with precondition: [V>=1]

* Chain [38]: 0
with precondition: [V=2,V1=1]

* Chain [37]: 0
with precondition: [V=2,V1=2]

* Chain [36]: 4*s(37)+3
Such that:aux(10) =< V
s(37) =< aux(10)

with precondition: [V1=0,V>=1]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [41] with precondition: [V=0]
- Upper bound: 3
- Complexity: constant
* Chain [40] with precondition: [V>=0,V1>=0]
- Upper bound: 8*V+10*V1+3
- Complexity: n
* Chain [39] with precondition: [V>=1]
- Upper bound: 2*V+1
- Complexity: n
* Chain [38] with precondition: [V=2,V1=1]
- Upper bound: 0
- Complexity: constant
* Chain [37] with precondition: [V=2,V1=2]
- Upper bound: 0
- Complexity: constant
* Chain [36] with precondition: [V1=0,V>=1]
- Upper bound: 4*V+3
- Complexity: n

### Maximum cost of start(V,V1): max([2,nat(V1)*10+4*V+ (2*V+2)+2*V])+1
Asymptotic class: n
* Total analysis performed in 250 ms.

(10) BOUNDS(1, n^1)